package com.jlsoft.web.admin.qr.service.impl;

import cn.hutool.extra.qrcode.QrCodeUtil;
import com.jlsoft.config.SimpleResponse;
import com.jlsoft.web.admin.qr.service.IQrService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
public class QrServiceImpl implements IQrService {
    @Override
    public SimpleResponse validateQrContent(String content) {
        if(StringUtils.isEmpty(content))
            return new SimpleResponse(1, "请录入原始文字", false);

        return new SimpleResponse(0, null, true);
    }

    @Override
    public byte[] createQrCode(String content) {

        return QrCodeUtil.generatePng(content,300, 300);
    }
}
